const mongoose = require('mongoose')

// 连接数据库
mongoose.connect('mongodb://127.0.0.1:27017/book-curd')

// 导出 监听 连接成功和失败的函数
module.exports = function(onSuccess,onError){
  mongoose.connection.on('open' , onSuccess)
  mongoose.connection.on('error', onError )
}